import {
    createRouter,
    createWebHashHistory,
} from 'vue-router'
import {ElNotification} from "element-plus";

const notNeedLogin = ["/landpoint", "/preview"]
import HomeVue from '../home/Home.vue';
// const router = createRouter({
//     history: createWebHistory(),
//     base: '/',
//     mode: 'history',
//     routes: [
//         {
//             path: '/landpoint',
//             name:'home',
//             component: ()=>import('../home/Home.vue'),
//             children:[    {
//                 path:'/preview',
//                 component:()=>import('../view/previewWord.vue')
//             },]
//         },

//         {
//             path:'/previewPdf',
//             name:'previewPdf',
//             component:()=>import('../view/previewPdf.vue')
//         }
//     ]
// })
const routes = [
    {
        path: "/",
        name: "land",
        meta: {
            title: '系统登录'
        },
        component: () => import('../view/Home.vue')
    }
    ,
    {
        path: "/landpointtc",
        name: "landpointtc",
        meta: {
            title: '系统登录'
        },
        component: () => import('../view/Home.vue')
    }
    ,
    {
        path: "/landpoint",
        name: "landpoint",
        meta: {
            title: '系统首页'
        },
        component: () => import('../home/Home.vue')
    },
    {
        path: "/userManagement",
        name: "userManagement",
        meta: {
            title: '用户管理'
        },
        component: () => import('../components/mainView/components/userManagement/index')
    }
    ,
    {
        path: "/personalCenter",
        name: "personalCenter",
        meta: {
            title: '个人中心'
        },
        component: () => import('../components/mainView/components/personalCenter/index')
    }
    ,
    {
        path: "/preview",
        name: "preview",
        meta: {
            title: '预览页'
        },
        component: () => import('../view/previewWord.vue')
    }
    ,
    {
        path: "/allLandForm",
        name: "allLandForm",
        meta: {
            title: '筛选表'
        },
        component: () => import('../components/mainView/components/allLandForm/index')
    }
]
const router = createRouter({
    history: createWebHashHistory(),
    base: '/',
    routes
});

// router.beforeEach((to, from, next) => {
//     if (notNeedLogin.indexOf(to.fullPath) !== -1) {
//         next('/landpointtc');
//         ElNotification({
//             showClose: true,
//             message: '未登录，请重新登录',
//             type: 'warning',
//         })
//     }
//     next();
// })

export default router;
